home *** CD-ROM | disk | FTP | other *** search
/ Aminet 45 / Aminet 45 (2001)(GTI - Schatztruhe)[!][Oct 2001].iso / Aminet / game / role / ldmud-3.2-bin.lha / mud / doc / efun / regexp < prev    next >
Text File  |  2001-04-06  |  2KB  |  60 lines

  1. SYNOPSIS
  2.         string *regexp(string *list, string pattern)
  3.  
  4. DESCRIPTION
  5.         Match the pattern pattern against all strings in list, and
  6.         return a new array with all strings that matched. This
  7.         function uses the same syntax for regular expressions as ed():
  8.         
  9.         . Match any character.
  10.         
  11.         ^ Match begin of line.
  12.         
  13.         $ Match end of line.
  14.         
  15.         \< Match begin of word.
  16.         
  17.         \> Match end of word.
  18.  
  19.         \B not at edge of a word (supposed to be like the emacs
  20.            compatibility one in gnu egrep), since 3.2@249
  21.  
  22.         x|y Match regexp x or regexp y.
  23.         
  24.         () Match enclosed regexp like a 'simple' one.
  25.         
  26.         x* Match any number (0 or more) of regexp x.
  27.  
  28.         x+ Match any number (1 or more) of regexp x.
  29.         
  30.         [..] Match one of the characters enclosed.
  31.         
  32.         [^ ..] Match none of the characters enclosed. The .. are to
  33.         replaced by single characters or character ranges:
  34.         [abc] matches a, b or c.
  35.         [ab0-9] matches a, b or any digit.
  36.         [^a-z] does not match any lowercase character.
  37.         
  38.         \c match character c even if it's one of the special characters.
  39.         
  40.         If there is an error in the regular expression 0 will be
  41.         returned.  Remember that the character "\" has to be escaped
  42.         with a "\" when written as a LPC string.
  43.  
  44. EXAMPLE
  45.         string strs;
  46.         if (strs = regexp( ({"please, help me Sir John."}),
  47.                                  "\\<help\\>.*\\<me\\>"))
  48.            if (sizeof(strs)
  49.               write("It matches.\n");
  50.         
  51.         The regular expression will test the given string (which is
  52.         packed into an array) if there is something like "help ... me"
  53.         inside of it.
  54.         
  55. HISTORY
  56.         LDMud 3.2.9 added metacharacter '+'.
  57.  
  58. SEE ALSO
  59.         regexplode(E), regreplace(E), sscanf(E)
  60.